<?php
$op = get_get("op");
if ($op == "headimage") {
    img();
}

function img()
{
    $img = getHeadImageURL();
    $info = getimagesize($img);
    $imgExt = image_type_to_extension($info[2], false);
    $fun = "imagecreatefrom{$imgExt}";
    $imgInfo = $fun($img);
    header('Content-Type:' . image_type_to_mime_type(exif_imagetype($img)));
    $quality = 100;
    if ($imgExt == 'png')
        $quality = 9;
    $getImgInfo = "image{$imgExt}";
    $getImgInfo($imgInfo, null, $quality);
    imagedestroy($imgInfo);
}
?>